/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package intmag;

//import java.awt.Image;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Den
 */
public class Bascket extends JPanel {
    
    private static final String PRICE = "Price: ";
    private static final String GOODS_COUNT = "Total goods: ";
    private static ImageIcon bascketIcon;
    
    static {
        bascketIcon = new ImageIcon (Bascket.class.getClassLoader().getResource("intmag/images01.jpg"));
    }
    
    private JLabel bascketIconLabel;
    private JLabel totalPriceLabel;
    private JLabel goodsCountLabel;
    
    private int count;
    private double total;
    
    public Bascket() {
        bascketIconLabel = new JLabel(bascketIcon);
        totalPriceLabel = new JLabel();
        goodsCountLabel = new JLabel();
        init();
    }
    
    private void init() {
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        add(bascketIconLabel);
        add(Box.createHorizontalStrut(10));
        add(goodsCountLabel);
        add(Box.createHorizontalStrut(10));
        add(totalPriceLabel);
        
    }
    
    void inGoodsCountAndChangeLabelText() {
        goodsCountLabel.setText("");
        count++;
        goodsCountLabel.setText(PRICE.concat(String.valueOf(count)));
        
    }
    
    void addPrice(double price) {
        totalPriceLabel.setText("");
        total += price;
        totalPriceLabel.setText(GOODS_COUNT.concat(String.valueOf(count)));
    }
    
    void clear() {
        totalPriceLabel.setText("");
        goodsCountLabel.setText("");
    }    

    void inGoodsCountAndChangeLabelText(String buy_now) {
    }
    
}
